fix compilation error, and added print function