Fix for issue #42

Added error handling for timeouts.