null reference and count error