Character doesn't grab the ledge properly

Guys, does anyone have any idea? Please help.