working version of quadprog