added DEVMODE and various fixes