Fix issue due to invalid data in database