Added check on resize as mentioned in #7