Remove some usages of java.util.Optional