added more data checks