Fixes for optionals and logging