adding functions to make flux more robust