Fixed bug with incorrect device determination