Fixed other small logic error