check incoming data from DB

Workaround for issue #813: checking incoming data is always good idea.