Classifier: Use 'as' instead of explicit cast

Fixes #917 (240b5aa)

Fixes #918 (2be9b3b)