fix issue #12 thanks to @nsf