null pointer bug fixed in Tasks class