fixed compiler errors but segfault
fixed pointers
removed diagnostics