added some protections against seg fault...but they didn't work