fixed possible segfault
Merge branch 'working'