fix array keys bugs