Fixed a segfault and another stupid error