Pr minor bug fixes

Fixed a few minor bugs and added a missing search function.