resolved logic issue