Fix bug in new constraint writer and improve error reporting.
Better error reporting in mocy entry-point detector.