Improved clear and check GL errors