Fixed the resize bug