added full ruby implementation for vm compatibility