Comment clarifying fix for #2039.
Fix some minor code hygiene issues
Use rassert() instead of assert()