Fix bugs in arg/state magic (#547)