Fix scoping issues in PaperScript code.