Fix bound checks when printing a problem