endTypes event handler fixes first click bug