fixed codeblock out of bounds issue