fix undefined $fm and remove double defintion