Add debug environment. Some fixes.