Resolved the previous logic error