fixed misplaced function def