Fixes to use orNull
Fix missing imports, fix compiler problem with match