Fixed some errors found by netbeans IDE.