fixed bugs in overlay