fix up logic