Fix empty callback problem, and added the respective tests.
Enhanced arguments checking.