dropped redundand type assertion, added mising check