solved permission segfault and other changes