Solved the issue #280

Solves the bug that the replaced scene persists in memory.

The idea/code belongs to luuthanhtuan.
As the bug is fatal and should be fixed asap, I decided to push it to upstream.
I leave it to wise9 to pull the code from me or to wait for the pull request from luuthanhtuan (i dont care about rights, just wanna hurry).

Rewrite of #283