added sanitizy checks in case of DB fuckups