modified API to return null rather than throwing an error
add tests