Removed usage of deprecated API and fixed build