Fix #1011 and add tests
Merge pull request #1013 from ractivejs/gh-1011

Fix #1011 and add tests