fixed syntax bugs and some runtime ones in new reactive agent code, tested breifly on bagged data