updated code to work with latest compiler