trim trailing whitespace and check for cb in wrap