handled null pointer exceptoin when there is no charges