Fixed bugs

Memory leak on projections still to be fixed