Fixed error handling in pac.py