Added safeApply to rootScope