Add debug assertions and NDEBUG for release builds