fix: 'isValid' function may not work