fix for #22 and #23