Fix for #112

Hopefully replacement pull request for @mtravis's #122, which is not
against master. Tested with multiple layers, point, line, and poly, but not categorized/graduated.