fix bug when converting array to hash