fixing issue 1276 again, thanks Alan