added search prepared statement. fixed search bug