Fix for #192 && #206 && #212

Fixes for #192, #206 and #212

r -> @Gioyik @aesedepece ??