Rectify a mistake in resize(); now it works well