fix for null case. add test
add more tests