modified to fix generated sexps and allow to_source on unattached methods