updating controller factory to handle null type