Minor API tweeks for handling errors