calculate_width now uses hostexpand to work in regexp in hosts