fixed a bug with case 505.