fixing silly logic error