added dynamic timeout. #295