code updated to avoid unnecessary crash
commit changes