Refactoring FRAMELENGTH / CMDFRAMELENGTH and CommandIO. I hope the red screen doesn't appeare anymore, but at the moment I find no way to write an unit test for this case.