fixed performance problem saving to hash