fix for memory functions wrap-around bug on linux