final bug fix before merge