Added logic error fix