added bug fixes from the second sheet