Fix for #23 and functional test to confirm