Various fixes

Hi,
Could you please merge these changes to the master branch.
I believe we discussed all of these.
Regards,