Fix bugs that caused App::riap to croak