Proteins with nontrivial topology, containing knots and slipknots, have the ability to fold to their native states without any additional external forces invoked. A mechanism is suggested for folding of these proteins, such as YibK and YbeA, that involves an intermediate configuration with a slipknot. It elucidates the role of topological barriers and backtracking during the folding event. It also illustrates that native contacts are sufficient to guarantee folding in approximately 1-2% of the simulations, and how slipknot intermediates are needed to reduce the topological bottlenecks. As expected, simulations of proteins with similar structure but with knot removed fold much more efficiently, clearly demonstrating the origin of these topological barriers. Although these studies are based on a simple coarse-grained model, they are already able to extract some of the underlying principles governing folding in such complex topologies.