fix for issue #26, by Ayden Beeson (thanks!)