change overlay position to prevent empty spaces