bugfix for #24 and #26