Fixed bug that caused the application to crash on window resize