Fixed segfault, removed warning