Fixed bugs using push, shift, and keys on references