enhance error controling