Better errors in production; various fixes