solution to debug exercise