[FIX] added loop to avoid indexing when several ids are sent to writhe method