added safe allocating functions
made itoa more memory friendly