even more fixes; pass some attributes to function return type
better compatibility with sparse