Fixing NoMethod error