Fix for #512

The sublime-text-3 branch still was causing the problems reported in #512. This (although hacky) fixes it.