fixed previous code to only set params if they exist