added debug option (default false)