Fixed handling swap in vmgen