Finally finished fix for issue #19