fixed inheritance check, a bit hacky but it passes all tests at least...