Convert undefined values to null