Fix #472
Fix #541
Fix #544
Merge pull request #550 from Atheros1/master

Various fixes