Add ruby script, remove debug printfs and fix some segfaults