Program: fixed null pointer exception