fixed several generation issues and added minimal test to check compilation