Fixed null case handlin