Add proper error logging (thx @grncdr & @pxlpnk)