try to fix logic error