model class structure changed, some bug fixes