fixed bad optimization