Fix for rmi throws error "no such id".

Closes #9056. Also closes #9170. Thanks @coolljt0725 for the start!
Includes integration-cli test, I am not necessarily in love with, but it is necessary evil. :smiling_imp: 
Ya, it looks like the call of the method on the nil pointer is just a side effect of the valid not being used within that function or having a nil check on `current`