add global guards and support nullable values