gaussy.jl: copy x before making setindex! changes and other critical refactoring