Fix double display and possible NullPointerException