Fixed push and pop safe operations to be to spec.