by Benjamin. Fixed bug 2462, 2458, 2456, 2452, 2443, 2441, 2440.