fix #29 model data bug. and refactoring.