slight logic error