Fixed some NullPointerExceptions
Reverted code style