added some console messages to debug javascript errors