improving error handling a tiny bit