fixed misplaced code