there is a problem with last condition but I cant find error