Trying to fix bad JS, giving up