Some more fixes
Merge pull request #712 from dswd/fixes2

Some more fixes and removed unused code