fix #1013: better slice processing