Fix out of bounds locations

Signed-off-by: Ian Macalinao <ianmacalinao@gmail.com>