fixed preliminary segfaults