Fixed some possible NullReferenceExceptions in base controllers. Fixes #4