fixed two issues in grd5 parsing found by afl