need to implement safe casting operations