Add timeout and fix test