updated to support latest sand-grain