Fix typo
Clean up code, automatic crash detection, fix some bugs