sanitize array only when array is present