fixing errors reported by Mafields