Eliminate several bugs in optional.