Fixed NPE on null device