FIX: use nested import to remove dependency on PIL