Fixed npe and added annotation to method