fixed factoring problem