ensures more robust checking in error handling process
Merge pull request #3 from KrakeIO/more_robust

ensures more robust checking in error handling process