added flask compatibility