clamps negative indexes to 0