Fix resize problem when running JS