Fixed some segfaults.