Correctly push/pop stack index