fixing errors on saving models