fixed stupid ifp function