fix check function