removed possible resource leaks