Use prepared query, small fixes