Few fixes and improvements for reliability/usability

Please see individual commits for detailed descriptions.