Fix for invalid reference to window.length
Merge pull request #198 from ryandemmer/patch-2

Fix for invalid reference to window.length