made some changes to make it run on ubuntu. then it crashes...