Fix resizing JavaScript