fixing bugs 3957, 3670, 4299 and 4312