fixed issue with missing $FLAGS variable