Fix logic bug in data structure creation

Don't attempt to merge `attributes` if they aren't a hash.