Fixing edit page javascript