adding more error cases for undefined data