specialize numpy scalars by type (fixes issue #344)
don't assume objects are scalars (issue #348)
Merge pull request #349 from bfredl/scalarfix

Fixes for issues #344 and #348 (scalar behaviour)