fixed minor bugs on window resize