hw1-1 logic error