add timeout and error code