Fixed bugs & memory leaks.