prolog added, bug fixed