Stack overflow REPAIRED