moved assert into right place