Various fixes and checks