fixed the bugs as reported by findbug