bug fixes. Add a quick walkaround to avoid the invalid location problem from issue #113.