Added argument validation in Platform.getDevices and Program.build + misc other fixes