Moved the check on num_assets in the right position