Bug fix (thanks Nick Lanham)