fixed loop of adding hashes to an array