fixed sensor issues, working version