fix: debug index page, use correct method to check if directory exists