bug# 409, fixed an infinite loop