fix minor bugs, new error layout