fixed missing includes
added cout messages to track down handle problem