Change default parameter to deepcopy so that it's not polluted by pass-by-reference issues (fixes #38)