fixes to work in production rails mode