by Benjamin fix bug 2634, 2633, 2632, 2637