Added log-det gradient test and debugged some issues