Adds wrong flag test case, fixes some test issues