Fixed resize function.