Fixing some things. Bug: dereferencing null optional.