Bugfixes: issues  #307 and #296