fix infinite loop
proper corruption handling
`mayday` command for corruption handling
sync JS file with Arthur file