Added error console logging