Fix issue 1002