Add safety, fix max_len conversion, fix spec misreading