add a check on invalid rid serialization. issue #2460
Merge branch 'rid_check' into develop