Fixed more bugs exposed by modularization