Fixing bug when screen is resized