Fixed memory leak and rendering background