Bug fixes; #184 #185 #188 

Bug fixes; #184 #185 #188 

@raamdev This PR includes everything I submitted in #184 #185 too. I had to do that in order to resolve the final issue reported here in #188. Sorry for any confusion.