fixed small bug trying to $apply() while $$phase