fixed qreduce bugs

tested with over 100 random graphs