Added runtime type checking