Fix bug #508