fix misplaced code