Fix bug causing "is_hash" checks on non-arrays

This causes unecessary performance issues due to an over-check, and also
causes a fatal error since the is_hash check requires the parameter to
be of the type "array"