Port back changes from http://paperjs.org