Some fixes and adaptions