Fixed a few minor bugs to remove 'Find Bugs' warnings