fix saving a trigger in database