specialize numpy scalars by type (fixes issue #344)
don't assume objects are scalars (issue #348)