Fixed errors for empy cases