Cherry-pick #560 fix systemstackerror