Max,

The code in the library is OK.