added queries logging
minor bug fixed