fixed source positions, fixed string bug, removed memory leaks and heap overruns