Added Some safety checks