Fix catch error for temp
Further improvements for new MySQL database layout