Fixing #171, #174, #192, #193