replace all asserts by exceptions, and use std::FUN instead of FUN