Improved version of PR #86. Fixes #86.
Merge pull request #141 from JamesMGreene/better_pr_86

Fix for Firebug error (improved version of PR #86).