Implemented handling of negative numbers + too low/high indexes.

Signed-off-by: Phillipp Ohl <phillippohl@gmail.com>