Fixed a bug in model