Fix some bugs in console open + add simple script for testing.