Stop stack when casting. Closes #520.