Fix frame shift issues. Improve debug problems.