Fixed null dereference