fixed issue 340 & 400