fixed issue 1385, thanks Alan