Add type, and fix bugs in model window