I/O Performance improvement and fixed leaking resources