Fix bug #512