added possible fix for weird segfaults
bugfixes