Fixed bug with save query