Corrected bugs in flask extension