corredcted a logic error