Potential refacturing bug-fixes. (resolved some crashes)