fix for #18 , credits to @waylaidwanderer