improved plugin error handling