added api memory safety for custom crates