A few small fixes
Merge pull request #492 from starwed/2dfix

A few small fixes to 2D functions