Bugfixes for #68 and #2480