correct logic error