Attempt to fix the logic error