stricter more robust code to prevent error in constraint checking