Add more checks for retrun values.