fixed bugs reported by Samir