Fixes #1 by preventing segfaults