Fixed some NullPointerExeptions