fix detection of tab count. resolves #304.