Fix bug in class proxy constructor detection when nil is passed for reference types