Made conversion functions (hopefully) crash proof