fixed bug that caused segfault

description of the bug in previous commit