Fixes for #56, #58, #59

Fixes for:
#56, #58, #59