fixed serious bug (wrong usage of function get_factor(...))