issue #3 - fixed segfault