To fix the bugs in your program, keep an error log.
Where did things get off-track? What obstacles appeared?