Added a couple of checks for safety

Signed-off-by: retep998 <retep998@verizon.net>