fixed edge case for question #7