Fix for #122 and #123