various fixes related to mongoose being weird