applied the patch provided by Andrey Petrov