some fixes and checks