tweak error handling