Fixing bugs, closing #208, #203, #197