Small logic error