Fix buffer-overflow on replaying mobigen script