Bug fixes and query fixes; register queries