Synchronization and NPE bugs fixed.