Fixed some random crashes