adding support for Prolog side references.