cleanup and timeout fix