fix bugs adding factoring step