Resolve null reference error