fix dynamic arr out of bound(fun bug)