A few extra exceptions will be thrown, when an error occurred.
Fixed the count function. which off course is much more efficient than using list.count