fixing problem code