improved px error handling