Handle negative index in slide number.

Related to issue #1710