Fix a few mixed-integer program bugs

* don't accidentally create symmetric matrices
* fix upper and lower bounds when variables have more than 2 dimensions
* don't crash when solver is terminated early