Fixes exception on application load

This should enable database migrations to be useful.