Some Bug Fixes in Principal.java