more robust error handling for post data