NPE Fix
Fixed editing logic