multiple segfaults solved