handle edge case with buggy entries in the database.