Start serial for classes with 1 and prevent double compile

This prevents the exact same method being compiled multiple times, where
the class and serial id for specializations are exactly the same.