improved error handling in dynamic recv