upgrade to solve (last 2 commits)

addresses issues 
- https://code.google.com/p/sympy/issues/detail?id=3720
- https://code.google.com/p/sympy/issues/detail?id=3721
- https://code.google.com/p/sympy/issues/detail?id=3722

**only the last 4 commits needs review**