Fixed some NPE/Formatting issues.