fixing ruined code