fixed #303: replace %ld with % PRId64
remove unused variable