Fixed bug with mysql retained data

Fixed bracket issue with retained data in mysql not returning result.
Also removed code that would never be called.