Fix for #23 and #24