Fixed bug described by @GillesVermeulen in #229