Added missing ID to where clause and moved 'try' above the query