fix memory leak and change window color