fixed nested stuff in factories and controllers