fixing bugs 3513 and 4278