Fixed code generation and size length errors