bug320 code cleaning to avoid php warnings in error log