Fixed use of deprecated function
Added TAG for debug messages