The second picture is correct. The rubber grommet goes toward the outside and fits over a hole in the cover. The oil has to be able to flow through the cover. Also, don't forget to put the spring back in between the back side of the filter and the crankcase. The spring holds the filter out against the cover.
Most 4-wheeler problems are caused by a loose nut connecting the handlebars and the seat!!
You only need two tools in life -- WD-40 and duct tape. If it doesn't move and should, use the WD-40. If it shouldn't move and does, use the duct tape.