Add more checks on input data

Authored by scarpino on Dec 10 2013, 6:56 PM.