added extra checks