Fix bug #509