- fixed several potential crashes