Fix bdd code and refactored some allocations for 8queens.