Fixed rare NPE when resources are tight
A safer fragment/activity handshake
Fixed compilation problem