Fix compiler warning and use static_assert