Ran findbugs and fixed some bugs