Fixed logical errors in simple homotopy method