bugfix in CheckSEXPForJSRef and CheckForRefClass