Add debug logging for bks_sec