Fixing controller factory bug