Fix some issues with optional values

Probably there is much more of them. Keep eye on them.