fixed working version