Added check for correct data - might be some bad records are retrieved.