Type checking abstract classes, fixes #346