Fixed compiling error by improving returning class