fixed bad code