Fixed further resource leaks