bug fixes on model