fix errors when @cvan's code blows up