BUG: Fix mean, var, std methods for object arrays.

This takes care to preserve the object type for scalar returns and
fixes the error that resulted when the scalar did not have a dtype
attribute.

Closes #4063.