Fixed some bugs in the FM class