bug fixes + 2pl logic correction