fixed issue #6 for 3 columns