updated safe cast functions and round off function