removed logic error