fix the timeout thing for real, minor performance tweaks