common: fix support function that wraps particle positions