add null check and some basic tests