Use array_replace to merge attributes

I also casted options to array to ensure it is always an array because of the null default value, to avoid weird bugs (should it default to an empty array instead ?)