Slight logic error