Fix bug causing wrong ID to be sent to onclick