fix the $apply error