Fixed SQL and persistent storage for programmes that were done.