Changed exceptions and hopefully fixed for Pi.