Fixes bug with cast and with Device setter/getter

USERGRID-1185