replaced 'create report' while with if. eliminated decode() suffices.