fix "Type of arg 1 to keys must be hash or array" error