Yet another small but important fix
Checks around heads to prevent crashing