Fix AssertionError bug