added check if it is headless