Fixes #218 and another bug
Minor change in recent fix 1f85ad8