Avoid the bug by accepting parametrized type instead of trait