singleton function fix