fix checks and function usage