Added tests for and fixed myapnea/www_myapnea_org#79 and myapnea/www_myapnea_org#80