fixes from Vitaliy's email 31.07.13