added resizing checks.