Fixed some buffer overrun code
Fixed some buffer overrun code