Fixed exit function for models