more prolog bug fixes