bug fix - final version