Initial fixes for stack layout