Fixed null reference bug.