Added logic to avoid to increment fields if the given value is null.