Some fixes

Please review to ensure I got it right :)