Minor refactor on debug mode to check for tmp directory or create if not exist