slightly improved error handling, along with a bigger buffer size