handle nulls and errors better.