Why is this $timeout necessary?