fixing wrong if statement