Fixes for updating query