Fix debug causing an error and an OOB error