Fixed memory leak

Other small updates