Changing a lot of bugs, same as commit 66084d9 but for virtual judge