Fix type bounds (with thanks to @paulp)