Fixed the Flask tests & a bug.