Fix a bug in smooth-nd.cpp