First of your problem is that you're not looking in a further perspective. The ball blocks itself on a wall - just move it 0.5 pixels away. Why not try to unblock it instead? Later you treat a corner like a circle (do you mean a point? If not, I don't understand the idea and it makes me dizzy when I try).

It's OK to do quick, dirty fixes and try if they work. But after every such fix you should consider changing your base - well, you actually did that by asking the question, so I'll better get to the answer:

You have very easy conditions for your ball colliding with terrain, because:

 - terrain is made of squares, that are very easy to define mathematically, and therefore it's easy to detect collision (just check if X is higher then square's X but lesser then square's X plus square's width, then do same with it's Y and height)
 - additionally squares are tiles, that is, you have a grid.

So we have a situation:

![enter image description here][1]


 1. We assume the ball is never larger then a tile (or a cell of the grid)
 2. Therefore our ball takes usually one, but sometimes up to 4 cells as the lower ball on the picture.
 3. We first treat the ball as a cross. If we want the collision to be pixel-perfect, then we can't treat the ball as a square, because sometimes where square would take fourth cell with it's corner, a circle doesn't reach. On example picture, top ball treated as a square would take a cell on left and down from it, while it shouldn't.
 4. To count if the ball takes fourth cell, we treat it like a circle. That's a little bit less or more tricky, depends on how accurate you want your collision detection to be. Solution for perfect accuracy is to check two points that extend most:

![enter image description here][2]


 function xToGrid ( x:Number ):int {
 	return x % 20;
 }
 
 function yToGrid ( y:Number ):int {
 	return y % 20;
 }
 
 /**
 * assuming the ball is not bigger then tile/cell.
 */
 function markTilesAsOccupiedByBall ( x:int, y:int, r:int ):void {
 	var left:int = x - r;
 	var right:int = x + r;
 	var top:int = y - r;
 	var bottom:int = y + r;
 	
 	var centerTileX:int = xToGrid ( x );
 	var centerTileY:int = yToGrid ( y );
 	
 	var localPosX = x % 20;
 	var localPosY = y % 20;
 	
 	var x1:Number;
 	var y2:Number; 
 	
 	if ( localPosX < 10 ) x1 = localPosX;
 	else x1 = 20 - localPosX;
 	x1 += .1; //to actually go outside the cell
 	
 	if ( localPosY < 10 ) y2 = localPosY;
 	else y2 = 20 - localPosY;
 	y2 += .1; //to actually go outside the cell
 	
 	//Pitagoras: r^2 = x^2 + y^2
 	// r*r = x1*x1 + y1*y1
 	// we don't know y1
 	// y1*y1 = r*r - x1*x1
 	var y1:Number = Math.sqrt ( r * r - x1 * x1 );
 	
 	// r*r = x2*x2 + y2*y2
 	// we don't know x2
 	var x2:Number = Math.sqrt ( r * r - y2 * y2 );
 	
 	if ( localPosX < 10 ) {
 		x1 = x - x1;
 		x2 = x - x2;
 	} else {
 		x1 = x + x1;
 		x2 = x + x2;
 	}
 	
 	if ( localPosY < 10 ) {
 		y1 = y - y1;
 		y2 = y - y2;
 	} else {
 		y1 = y + y1;
 		y2 = y + y2;
 	}
 	
 	//it is possible that all below operations assign true to same tile!
 	//You should delete duplicates especially for optimization,
 	//but duplicates could also make some mechanisms trigger more than once
 	tilesOccupied.clear();
 	tilesOccupied.push ( [xToGrid(left), centerTileY] );
 	tilesOccupied.push ( [xToGrid(right), centerTileY] );
 	tilesOccupied.push ( [centerTileX, yToGrid(top)] );
 	tilesOccupied.push ( [centerTileX, yToGrid(bottom)] );
 	//the "corner":
 	tilesOccupied.push ( [xToGrid(x1), yToGrid(y1)] );
 	tilesOccupied.push ( [xToGrid(x2), yToGrid(y2)] );
 }
 
 
 function detectCollision ():void {
 	markTilesAsOccupiedByBall ( ball.x, ball.y, ball.radius );
 	for ( var i:int = 0; i < tilesOccupied.length; i++ ) {
 		if ( grid [ tilesOccupied[i][0], tilesOccupied[i][1] ] == GridType.WALL ) {
 			//make some action
 		}
 	}
 }

You should substitute '20' literals with some CELL_WIDTH constant. Keep in mind this could be optimized a lot, but I didn't want e.g. mess with minus signs, because the equations would be a lot less readable if I did.

 [1]: https://i.sstatic.net/jRAHS.png
 [2]: https://i.sstatic.net/82fey.png