fixes #7 credit to @rzykov