fixing bad code