Applied patches from Philip Blundell <pb@nexus.co.uk>, to improve PIC support.