Fixed some crashes
Fixed #20