switched to fprintf for sending queries to bc